
/****************************** 
 * 
 *  Create By: Arthur.li
 *  
 *  Create At: 2009年4月24日 9:47:41
 *  
 *  Description: 用户设备绑定信息
 *  
 *  Remark: 
 *  
 * ****************************/

namespace Jumpton.SFA.Server.Entity {
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    using System.Runtime.Serialization;
    
    
    [System.SerializableAttribute()]
    [Map("UserDeviceBound")]
    public class UserDeviceBound : ObjectRow {
        
        public UserDeviceBound() {
        }
        
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public UserDeviceBound(System.Data.DataRow dataRow, ObjectTable parent) : 
                base(dataRow, parent) {
        }
        
        /// <summary>
        /// 供反序列化使用的构造函数
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected UserDeviceBound(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
                base(info, context) {
        }

        [Key("ID", true, true)]
        public decimal ID
        {
            get
            {
                return (System.Decimal)GetValue("ID");
            }
            set
            {
                SetValue("ID", value);
            }
        }

        [Field("UserID")]
        public decimal UserID
        {
            get
            {
                return (System.Decimal)GetValue("UserID");
            }
            set
            {
                SetValue("UserID", value);
            }
        }

        [Field("DeviceID")]
        public decimal DeviceID
        {
            get
            {
                return (System.Decimal)GetValue("DeviceID");
            }
            set
            {
                SetValue("DeviceID", value);
            }
        }

        [Field("ACTIVE")]
        public bool ACTIVE
        {
            get
            {
                return (System.Boolean)GetValue("ACTIVE");
            }
            set
            {
                SetValue("ACTIVE", value);
            }
        }

        [Field("DOMAIN_ID")]
        public decimal DOMAIN_ID
        {
            get
            {
                return (System.Decimal)GetValue("DOMAIN_ID");
            }
            set
            {
                SetValue("DOMAIN_ID", value);
            }
        }

        [Field("LAST_UPDATER")]
        public string LAST_UPDATER
        {
            get
            {
                return (System.String)GetValue("LAST_UPDATER");
            }
            set
            {
                SetValue("LAST_UPDATER", value);
            }
        }

        [Field("LAST_UPDATE_TIME")]
        public decimal LAST_UPDATE_TIME
        {
            get
            {
                return (System.Decimal)GetValue("LAST_UPDATE_TIME");
            }
            set
            {
                SetValue("LAST_UPDATE_TIME", value);
            }
        }

        [Field("CREATE_TIME")]
        public decimal CREATE_TIME
        {
            get
            {
                return (System.Decimal)GetValue("CREATE_TIME");
            }
            set
            {
                SetValue("CREATE_TIME", value);
            }
        }
    
    }

    /// <summary>
    /// 组合查询手机号码，IMEI,IMSI
    /// </summary>
    [RelationMap("UserDeviceBound", typeof(UserDeviceBound), "A")]
    [Relation(RelationJoinType.Left, typeof(MobileDeviceInfo), "B", "A", "ID", "DeviceID")]
    [Relation(RelationJoinType.Left, typeof(Person), "D", "A", "Id", "UserId")]
    public class UserDeviceInfo : ObjectRow
    {
        public UserDeviceInfo(){}
        public UserDeviceInfo(DataRow row, ObjectTable parent) : base(row, parent) { }
		[Key("ID",TableAlias="A")]
        public decimal ID { get { return (decimal)GetValue("ID"); } }

        /// <summary>
        /// 员工ID
        /// </summary>
        [Field("UserId", TableAlias = "A")]
        public decimal EmployeeID { get { return (decimal)GetValue("UserId"); } }

        /// <summary>
        /// 员工姓名
        /// </summary>
        [Field("Name", TableAlias = "D")]
        public String Name { get { return (String)GetValue("Name"); } }

        /// <summary>
        /// 设备串号
        /// </summary>
        [Field("IMEICode", TableAlias = "B")]
        public string IMEICode { get { return (string)GetValue("IMEICode"); } }

    }
}
